package edu.suse.controller;

import edu.suse.common.base.RespResult;
import edu.suse.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sys_menu")
public class SysMenuController {
    @Autowired //自动装配，在Spring容器中找到实现类对象实例，自动匹配
    private SysMenuService sysMenuService;

    // 查询菜单接口
    @GetMapping(value = "/searchmenu")
    public RespResult queryMenu(){
        // 调用Service方法，将参数传递过去
        return sysMenuService.queryMenuListAll();
    }
    @GetMapping(value = "/findmenu")
    public RespResult findMenu(String status,String title,String url){

        // 调用Service方法，将参数传递过去
        return sysMenuService.findMenu(status,title,url);
    }
    @GetMapping(value = "/findMenuById")
    public RespResult findMenuById(String id){

        // 调用Service方法，将参数传递过去
        return sysMenuService.findMenuById(id);
    }
    @GetMapping(value = "/insertmenu")
    public RespResult InsertMenu(String perms,String title,String url,String pid,String icon){

        // 调用Service方法，将参数传递过去
        return sysMenuService.InsertMenu(perms,title,url,pid,icon);
    }
    @GetMapping(value = "/updatemenu")
    public RespResult updatemenu(String id, String perms,String title,String url,String pid,String icon){

        // 调用Service方法，将参数传递过去
        return sysMenuService.updatemenu(id,perms,title,url,pid,icon);
    }
    @GetMapping(value = "/deletemenu")
    public RespResult deletemenu(String id){

        // 调用Service方法，将参数传递过去
        return sysMenuService.deletemenu(id);
    }
}
